import java.io.InputStream;
import java.io.IOException;
import java.util.StringTokenizer;

/*
 * Reads the input from the console
 */
final class MyBufferedReader 
{
   private InputStream in;
   /*
    * @param 
    */
   public MyBufferedReader (InputStream in) 
   {
       this.in = in;
   }
   public String readLine () throws IOException 
   {
       final StringBuffer sb = new StringBuffer(80);
       int                i  = 0;
       while (((i = in.read()) != '\n') && (i != -1))
           if (i != '\r')
               sb.append((char) i);
       if (i == -1)
           return null;
       return sb.toString();}}

/*
 * This is the class AustralianVoting
 */
public class AustralianVoting 
{
   static String[] players;
   static int[][] table;
   static int[] tally;
   static int plyrs;
   static boolean[] losers;
   static int half; //minimum votes needed to win
   static int min;
   static int max;
   static int ballots;//number of ballots

   public static boolean read (MyBufferedReader in) 
   {
       String s;
       try 
       {
           s = in.readLine();
       }
       catch (IOException e) 
       {
           return false;
       }
       if (s == null)
           return false;
       
       //initialize new variables
       plyrs = Integer.parseInt(s);
       players = new String[plyrs];//names of contestants
       table = new int[1000][plyrs];//all numbers in ballots
       
       for(int x = 0; x != plyrs; ++x)
       {//adds candidates in a list
    	   try 
    	   {
    		   s = in.readLine();
    	   }
    	   catch (IOException e) 
    	   {
    		   return false;
    	   }
    	   players[x] = s;}//adds 2ndary votes to players array
   
       try {
    	   s = in.readLine();
    	   }
       catch (IOException e) 
       {
    	   return false;}
       ballots=0;
       while (s != null && s.length() != 0) 
       {//adds ballots to list and adds first round
            StringTokenizer st = new StringTokenizer(s);
            for(int i = 0; i < plyrs; ++i)
            {
            	table[ballots][i] = Integer.parseInt(st.nextToken());
            }
           ++ballots;
           
           try 
           {
        	   s = in.readLine();
           }
           catch (IOException e) 
           {
        	   return false;
           }
           
       }
       half = (ballots>>1);
       
       return true;
       }

/*
 * Counts all of the votes inputted, and then checks for a winner. Eliminates losers until a winner is found, or until a tie is reached. 
 */
   public static void eval () 
   {//converts one num from string
	   losers = new boolean[plyrs];//losers for each tally

	   if(ballots==0)
	   {
		   for(int i=0; i<plyrs; ++i)
		   {
    				System.out.println(players[i]);
		   }
    			return;
       }
       boolean exit = false;
       do
       {

    	   tally = new int[plyrs];
           for(int i = 0; i < ballots; ++i)
           {
                   int next = 0;
                   while(next<plyrs && losers[table[i][next]-1])
                   {
                           ++next;
                           //System.out.println("i:"+i+" next:"+next+" plyrs:"+plyrs);
                   }
                   //if(next<plyrs)
                   tally[(table[i][next]-1)]++;
                  // ++next;

           }

           min = 99999;
           max = 0;
           //finding min and max
           for(int i = 0; i < plyrs; ++i)
           {
        	   if(tally[i]>((half)+1))
        	   {
	       	   		System.out.println(players[i]);
	       	   		exit=true;
	       	   		break;
       	   	   }
        	   else {if(!losers[i] && tally[i]>max)
                           max = tally[i];
       	   	   		if(!losers[i] && tally[i]<min)
                           min = tally[i];
               }
           }
           //check for winners
           if(min==max && !exit)
           {
        	   for(int i=0; i<plyrs; ++i)
        	   {
   				if(!losers[i])
   					System.out.println(players[i]);
   				}
   				exit = true; 
           }
           
           for(int i = 0; i < plyrs; ++i)
           {
        	   	   
                   if(tally[i]==min)
                   {
                           losers[i]=true;


                   }
           }



   }
   while(!exit);
       
   }
   
}
